package ru.agiledev.akb.client.utils;

import ru.agiledev.akb.shared.QType;

/**
 * Created by a.kirillov
 * Date: 5/14/11 Time: 1:40 PM
 */
public class Util {
    public static String join(String[] strings, String separator) {
        StringBuffer sb = new StringBuffer();
        for (int i=0; i < strings.length; i++) {
            if (i != 0) sb.append(separator);
            sb.append(strings[i]);
        }
        return sb.toString();
    }

    public static int indexOfType(QType type){
        String[] types =  QType.getTypesAsArray();
        for(int i=0; i<types.length; i++){
            if(types[i].equals(type.getString())){
                return i;
            }
        }
        return 0;
    }
}
